package com.iwdm.renovation.ui.electrical_area;

import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.iwdm.renovation.databinding.FragmentElectricalareaBinding;

public class MyElectricalareaRecyclerViewAdapter extends RecyclerView.Adapter<MyElectricalareaRecyclerViewAdapter.ViewHolder> {

     FragmentElectricalareaBinding binding;

    public MyElectricalareaRecyclerViewAdapter() {
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        binding = FragmentElectricalareaBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
        return new ViewHolder(binding);
    }

    @Override
    public void onBindViewHolder(final ViewHolder holder, int position) {
        holder.mContentView.setText("开工大吉轻奢小桌子女生卧室网红简约少女梳\n");
        holder.mView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.getContext().startActivity(new Intent(v.getContext(), electrical_areaActivity.class));
            }
        });
    }

    @Override
    public int getItemCount() {
        return 18;
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {
        public final View mView;
        public final TextView mContentView;

        public ViewHolder(FragmentElectricalareaBinding binding) {
            super(binding.getRoot());
            mView = binding.getRoot();
            mContentView =binding.content;
        }

    }
}
